package cn.codergege.demoapp.dao

abstract class DataAccessObject {
	def db
	
	// 子类实现它去获取所有表字段
	abstract List getFields()
	
	// 获取 dataset
	def dataSet() { db.dataSet(tableName) }

	private getWhereId() { "where id = ?" }

	String getTableName() {
		def name = this.getClass().name
		// ?
		return name[name.lastIndexOf('.') + 1..-4]
	}
}
